<template>
  <div class="dashboard-container">
    <el-card class="welcome-card">
      <div class="welcome-content">
        <h2>欢迎来到后台管理系统</h2>
        <p>您已成功登录系统</p>
      </div>
    </el-card>

    <el-row :gutter="20" class="stats-row">
      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-item">
            <div class="stat-icon bg-primary">
              <el-icon><User /></el-icon>
            </div>
            <div class="stat-info">
              <div class="stat-number">128</div>
              <div class="stat-label">用户数</div>
            </div>
          </div>
        </el-card>
      </el-col>

      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-item">
            <div class="stat-icon bg-success">
              <el-icon><Setting /></el-icon>
            </div>
            <div class="stat-info">
              <div class="stat-number">24</div>
              <div class="stat-label">角色数</div>
            </div>
          </div>
        </el-card>
      </el-col>

      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-item">
            <div class="stat-icon bg-warning">
              <el-icon><Menu /></el-icon>
            </div>
            <div class="stat-info">
              <div class="stat-number">18</div>
              <div class="stat-label">菜单数</div>
            </div>
          </div>
        </el-card>
      </el-col>

      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-item">
            <div class="stat-icon bg-danger">
              <el-icon><Warning /></el-icon>
            </div>
            <div class="stat-info">
              <div class="stat-number">5</div>
              <div class="stat-label">警告数</div>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>

    <el-row :gutter="20">
      <el-col :span="16">
        <el-card class="chart-card">
          <template #header>
            <div class="card-header">
              <span>数据统计</span>
            </div>
          </template>
          <div class="chart-container">
            <div class="chart-placeholder">图表占位区域</div>
          </div>
        </el-card>
      </el-col>

      <el-col :span="8">
        <el-card class="info-card">
          <template #header>
            <div class="card-header">
              <span>系统信息</span>
            </div>
          </template>
          <div class="info-content">
            <ul>
              <li>Vue 版本: 3.x</li>
              <li>Element Plus 版本: 2.x</li>
              <li>Pinia 版本: 2.x</li>
              <li>当前用户: admin</li>
              <li>最后登录时间: 2023-01-01 12:00:00</li>
            </ul>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
// 仪表盘页面
</script>

<style lang="scss" scoped>
.dashboard-container {
  .welcome-card {
    margin-bottom: 20px;

    .welcome-content {
      text-align: center;

      h2 {
        margin-bottom: 10px;
        color: #333;
      }

      p {
        color: #666;
      }
    }
  }

  .stats-row {
    margin-bottom: 20px;
  }

  .stat-card {
    .stat-item {
      display: flex;
      align-items: center;

      .stat-icon {
        width: 60px;
        height: 60px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 15px;

        .el-icon {
          font-size: 24px;
          color: #fff;
        }
      }

      .bg-primary {
        background-color: #409eff;
      }

      .bg-success {
        background-color: #67c23a;
      }

      .bg-warning {
        background-color: #e6a23c;
      }

      .bg-danger {
        background-color: #f56c6c;
      }

      .stat-info {
        .stat-number {
          font-size: 24px;
          font-weight: bold;
          color: #333;
        }

        .stat-label {
          font-size: 14px;
          color: #666;
        }
      }
    }
  }

  .chart-card,
  .info-card {
    margin-top: 20px;

    .card-header {
      font-weight: bold;
    }
  }

  .chart-placeholder {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f7fa;
    color: #999;
  }

  .info-content {
    ul {
      padding: 0;
      margin: 0;

      li {
        list-style: none;
        padding: 8px 0;
        border-bottom: 1px solid #eee;

        &:last-child {
          border-bottom: none;
        }
      }
    }
  }
}
</style>
